﻿using AnesSystem.Controls;
using AnesSystem.Models;
using AnesSystem.Services;
using AnesSystem.Util;
using System;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace AnesSystem.ViewModels
{
    public class ConfigTemplateCtrlViewModel : BaseViewModel<ConfigTemplateCtrlViewModel>
    {
        #region Variables

        private ObservableCollection<AnesRecordTemplateModel> _disAnesRecordTemplateModelList = new ObservableCollection<AnesRecordTemplateModel>();

        private AnesRecordTemplateModel _selAnesRecordTemplateModel = new AnesRecordTemplateModel();

        private Boolean _isAppend = true;

        private string _seach;
        private Boolean _isGeren = false;

        private string _templateName = "";
        private string _templateUser = "";

        #endregion

        #region Constructor

        #endregion

        #region Properties


        public ObservableCollection<AnesRecordTemplateModel> DisAnesRecordTemplateModelList
        {
            get
            {
                return _disAnesRecordTemplateModelList;
            }

            set
            {
                _disAnesRecordTemplateModelList = value;
                RaisePropertyChanged("DisAnesRecordTemplateModelList");
            }
        }

        public AnesRecordTemplateModel SelAnesRecordTemplateModel
        {
            get
            {
                return _selAnesRecordTemplateModel;
            }

            set
            {
                _selAnesRecordTemplateModel = value;
                RaisePropertyChanged("SelAnesRecordTemplateModel");
            }
        }


        public bool IsAppend
        {
            get
            {
                return _isAppend;
            }

            set
            {
                _isAppend = value;
                RaisePropertyChanged("IsAppend");
            }
        }

        #endregion

        #region Event

        #endregion

        #region Private Methods
        //模板加药


        #endregion

        #region Public/Protected Methods

        public void InsertTemplateModel()
        {

        }
        public void DelAnesRecordTemplateModel(AnesRecordTemplateModel anesRecordTemplateModel)
        {
            if (anesRecordTemplateModel != null)
            {
                DataManager.Instance.AnesRecordTemplateModelList.Remove(anesRecordTemplateModel);
                RaisePropertyChanged("DisAnesRecordTemplateModelList");
                AnesRecordTemplateModelService.Instance.DeleteById(anesRecordTemplateModel.Id);
            }
        }

        public void DelItemInfoModel(ItemInfoModel itemInfoModel)
        {
           // _selAnesRecordTemplateModel=null;
            if (itemInfoModel != null)
            {
                _selAnesRecordTemplateModel.ItemInfoList.Remove(itemInfoModel);
                RaisePropertyChanged("SelAnesRecordTemplateModel");
            }
        }
        #endregion

        #region EventHandlers

        #endregion

        #region Command

        #region ChangeDoctorCommand

        #endregion

        #region OpenPopupCommand

        #endregion
        #endregion
    }
}
